import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '设备名称',
    align:"center",
    dataIndex: 'deviceName'
   },
   {
    title: '设备编号',
    align:"center",
    dataIndex: 'deviceCode'
   },
   {
    title: '心跳命令',
    align:"center",
    dataIndex: 'cmd'
   },
   {
    title: '心跳时间',
    align:"center",
    dataIndex: 'createTime'
   },
   {
    title: '任务执行结果',
    align:"center",
    dataIndex: 'reply'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
    
  {
      label: "设备名称",
      field: 'deviceName',
      component: 'Input',
      //colProps: {span: 6},
  },
  {
    label: "设备编码",
    field: 'deviceCode',
    component: 'Input',
    //colProps: {span: 6},
},
     {
      label: "心跳时间",
      field: "createTime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
      //colProps: {span: 6},
	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '设备',
    field: 'deviceId',
    component: 'Input',
  },
  {
    label: '心跳命令',
    field: 'cmd',
    component: 'Input',
  },
  {
    label: '任务',
    field: 'cmdId',
    component: 'JSearchSelect',
    componentProps:{
       dict:"ac_dev_task,task_type,id"
    },
  },
  {
    label: '任务执行结果',
    field: 'reply',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  deviceId: {title: '设备',order: 1,view: 'text', type: 'string',},
  cmd: {title: '心跳命令',order: 2,view: 'text', type: 'string',},
  cmdId: {title: '任务',order: 3,view: 'number', type: 'number',dictTable: 'ac_dev_task', dictCode: 'id', dictText: 'task_type',},
  reply: {title: '任务执行结果',order: 4,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}